use QcTools::message::messageSender::MessageSender;

use crate::{component::Canvas, message::UiMessage};

pub struct UiContext<'a> {
    pub ui: &'a mut egui::Ui,
    pub sender: &'a MessageSender<UiMessage>,
    pub canvas_ptr: *mut Canvas,
}

impl<'a> UiContext<'a> {
    pub fn new(ui: &'a mut egui::Ui, sender: &'a MessageSender<UiMessage>) -> Self {
        Self {
            ui,
            sender,
            canvas_ptr: std::ptr::null_mut(),
        }
    }

    pub fn with_canvas_ptr(mut self, canvas_ptr: *mut Canvas) -> Self {
        self.canvas_ptr = canvas_ptr;
        self
    }
}
